<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>分配学生</title>
</head>
<body>
<h1>分配学生</h1>
<p>教师姓名：<span th:text="${teacher.name}"></span></p>

<h2>已分配的学生</h2>
<table cellspacing="0" border="2px" bordercolor="green" width="25%">
  <tr>
    <th>学号</th>
    <th>姓名</th>
    <th>Java成绩</th>
    <th>头像</th>
  </tr>
  <tr th:each="student : ${assignedList}">
    <td th:text="${student.id}"></td>
    <td th:text="${student.name}"></td>
    <td th:text="${student.java}"></td>
    <td>
      <img th:if="${student.photo != null}" th:src="@{'/img/' + ${student.photo}}" style="width:100px">
      <span th:if="${student.photo == null}">无头像</span>
    </td>
  </tr>
</table>

<h2>未分配的学生</h2>
<table cellspacing="0" border="2px" bordercolor="green" width="25%">
  <tr>
    <th>学号</th>
    <th>姓名</th>
    <th>Java成绩</th>
    <th>头像</th>
    <th>操作</th>
  </tr>
  <tr th:each="student : ${unassignedList}">
    <td th:text="${student.id}"></td>
    <td th:text="${student.name}"></td>
    <td th:text="${student.java}"></td>
    <td>
      <img th:if="${student.photo != null}" th:src="@{'/img/' + ${student.photo}}" style="width:100px">
      <span th:if="${student.photo == null}">无头像</span>
    </td>
    <td>
      <a th:href="@{'/assignment/assignStudent?teacherId=' + ${teacher.id} + '&studentId=' + ${student.id}}">分配</a>
      |
      <a th:href="@{'/photo_input?teacherId=' + ${teacher.id} + '&studentId=' + ${student.id}}">上传头像</a>
    </td>
  </tr>
</table>
</body>
</html>
